<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>教务管理成绩查询</title>
    <link rel="stylesheet" href="../css/homePage.css"/>
    <link rel="stylesheet" href="../css/homePageSelectScore.css"/>

    <script src="../js/public.js"></script>
    <script src="../js/axios.js"></script>
</head>
<body>
<div id="div">
    <div id="page_left">
        <div id=page_left_fonts>
            <span onclick="sy()">首&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;页</span>
        </div>
    </div>
    <div id="Page_right">
        <div id="Page_right_module_selectCourse_top">
            <button id="Page_right_module_selectCourse_bottom_btn" onclick="selectScore()">刷新课程</button>
        </div>
        <div id="Page_right_module_selectCourse_bottom">
            <div id="Page_right_module_selectCourse_bottom_noCourse">
                点击刷新按钮刷新课程
            </div>
        </div>
    </div>
</div>
<script>
    var userp;
    var userid
    window.onload = function () {
        document.getElementById("div").style.height =   window.screen.availHeight - 120 + "px";

        //添加数据(一级优先)
        axios.post("http://localhost:8080/JWGLSystem/homePageServlet").then(function (resp) {
                users = resp.data;
                userp = users.userPost;
                userid = users.id;

                if (users.userName == undefined) {
                    window.location.href = "../index.html";
                }

            //实现左侧菜单栏
            if (users.userPost == "管理") {
                document.getElementById("page_left_fonts").innerHTML +=
                    " <span id='selectCourse' onclick='kccx()'>课程查询</span>\n" +
                    " <span id='selectScore'  onclick = 'cjcx()'>成绩查询</span>\n" +
                    " <span id='addCourse' onclick = 'kcgl()'>课程管理</span>\n" +
                    " <span id='adTeachers' onclick = 'gljs()'>管理教师</span>\n" +
                    " <span id='adStudents' onclick = 'glxs()'>管理学生</span>\n" +
                    " <span id='addAnn' onclick='ggfb()'>发布公告</span>\n" +
                    " <span id='selectAnn' onclick='ggcx()'>公告查询</span>"
            } else if (users.userPost == "学生") {
                document.getElementById("page_left_fonts").innerHTML +=
                    "            <span id='selectCourse' onclick='kccx()'>课程查询</span>\n" +
                    " <span id='selectScore'  onclick = 'cjcx()'>成绩查询</span>\n" +
                    " <span id='selectAnn' onclick='ggcx()'>公告查询</span>"
            } else if (users.userPost == "老师") {
                document.getElementById("page_left_fonts").innerHTML +=
                    " <span id='selectCourse' onclick='kccx()'>课程查询</span>\n" +
                    " <span id='selectScore'  onclick = 'cjcx()'>成绩查询</span>\n" +
                    " <span id='addCourse' onclick = 'kcgl()'>课程管理</span>\n" +
                    " <span id='adStudents' onclick = 'glxs()'>管理学生</span>\n" +
                    " <span id='addAnn' onclick='ggfb()'>发布公告</span>\n" +
                    " <span id='selectAnn' onclick='ggcx()'>公告查询</span>"
            }

                //实现右侧查询区
                if (users.userPost == "管理") {
                    document.getElementById("Page_right_module_selectCourse_top").innerHTML +=
                        "<span id=Page_right_module_selectCourse_top_hint>填写学号:</span>\n" +
                        "            <input type=\"text\" id=Page_right_module_selectCourse_top_writeClass>";
                } else if (users.userPost == "老师") {
                    document.getElementById("Page_right_module_selectCourse_top").innerHTML +=
                        "<span id=Page_right_module_selectCourse_top_hint>填写学号:</span>\n" +
                        "            <input type=\"text\" id=Page_right_module_selectCourse_top_writeClass>";
                } else if (users.userPost == "学生") {
                    document.getElementById("Page_right_module_selectCourse_top").innerHTML +=
                        "                <span id = Page_right_module_selectCourse_top_class>"+users.userClassId+"</span>\n" +
                        "                <span id = Page_right_module_selectCourse_top_name>"+users.userName+"</span>";

                }
            }
        );
    }
</script>
</body>
</html>
